home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / pyshared / louie / sender.py < prev    next >
Text File  |  2005-11-29  |  1KB  |  40 lines

  1. """Sender classes."""
  2.  
  3.  
  4. class _SENDER(type):
  5.     """Base metaclass for sender classes."""
  6.  
  7.     def __str__(cls):
  8.         return '<Sender: %s>' % (cls.__name__, )
  9.  
  10.  
  11. class Any(object):
  12.     """Used to represent either 'any sender'.
  13.  
  14.     The Any class can be used with connect, disconnect, send, or
  15.     sendExact to denote that the sender paramater should react to any
  16.     sender, not just a particular sender.
  17.     """
  18.  
  19.     __metaclass__ = _SENDER
  20.  
  21.  
  22. class Anonymous(object):
  23.     """Singleton used to signal 'anonymous sender'.
  24.  
  25.     The Anonymous class is used to signal that the sender of a message
  26.     is not specified (as distinct from being 'any sender').
  27.     Registering callbacks for Anonymous will only receive messages
  28.     sent without senders.  Sending with anonymous will only send
  29.     messages to those receivers registered for Any or Anonymous.
  30.  
  31.     Note: The default sender for connect is Any, while the default
  32.     sender for send is Anonymous.  This has the effect that if you do
  33.     not specify any senders in either function then all messages are
  34.     routed as though there was a single sender (Anonymous) being used
  35.     everywhere.
  36.     """
  37.  
  38.     __metaclass__ = _SENDER
  39.  
  40.